/**
 *
 */
package de.cbf.cam.dsa.services.impl.rcp_provider.persister_service;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import de.cbf.cam.dsa.services.impl.rcp_provider.extension.RCPServiceImplExtensionPointResovler;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.interfaces.IRCPPersisterCulture;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.interfaces.IRCPPersisterProfession;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.interfaces.IRCPPersisterRace;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.interfaces.IRCPPersisterStructure;


/**
 * @author salter
 *
 */
public class ServiceRCPPersisterImpl implements IServiceRCPPersister {

	protected RCPServiceImplExtensionPointResovler extensions = RCPServiceImplExtensionPointResovler.getInstance();

	@Override
	public List<IRCPPersisterRace> getRacePersisters() {
		List<IRCPPersisterRace> result = new ArrayList<IRCPPersisterRace>();
		Set<String> persisterNames = extensions.getRegisteredRacePersisters();
		for (String name : persisterNames) {
			IRCPPersisterRace persister = extensions.getRacePersister(name);
			result.add(persister);
		}
		return result;
	}

	@Override
	public List<IRCPPersisterCulture> getCulturePersisters() {
		List<IRCPPersisterCulture> result = new ArrayList<IRCPPersisterCulture>();
		Set<String> persisterNames = extensions.getRegisteredCulturePersisters();
		for (String name : persisterNames) {
			IRCPPersisterCulture persister = extensions.getCulturePersister(name);
			result.add(persister);
		}
		return result;
	}



	@Override
	public List<IRCPPersisterProfession> getProfessionPersisters() {
		List<IRCPPersisterProfession> result = new ArrayList<IRCPPersisterProfession>();
		Set<String> persisterNames = extensions.getRegisteredProfessionPersisters();
		for (String name : persisterNames) {
			IRCPPersisterProfession persister = extensions.getProfessionPersister(name);
			result.add(persister);
		}
		return result;
	}

	@Override
	public List<IRCPPersisterStructure> getStructurePersisters() {
		List<IRCPPersisterStructure> result = new ArrayList<IRCPPersisterStructure>();
		Set<String> persisterNames = extensions.getRegisteredStructurePersisters();
		for (String name : persisterNames) {
			IRCPPersisterStructure persister = extensions.getStructurePersister(name);
			result.add(persister);
		}
		return result;
	}

}
